package com.pb.mapper;

import com.pb.pojo.Dept;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface DeptMapper {
//    @Results({
//            @Result(column = "create_time", property = "createTime"),
//            @Result(column = "update_time", property = "updateTime")
//    })
    @Select("select id, name, location,create_time, update_time from dept order by update_time desc")
    List<Dept> findAll();

    @Delete("delete from dept where id = #{id}")
    public void deleteById(Integer id);


    @Insert("insert into dept(name, Location ,create_time, update_time) values(#{name},#{location}, #{createTime}, #{updateTime})")
    public void add(Dept dept);

    @Select("select id, name,Location, create_time, update_time from dept where id = #{id}")
    public Dept getByid(Integer id);

    @Update("update dept set name = #{name}, Location=#{location},update_time = #{updateTime} where id = #{id}")
    public void update(Dept dept);


}
